package com.atguigu.yygh.sms.controller;
/*
手机验证码控制层
 */

import com.atguigu.yygh.common.result.R;
import com.atguigu.yygh.sms.service.SmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/sms")
public class SmsController {
    @Autowired
    private SmsService smsService;

    @PostMapping("/{phone}")
    public R sendCode(@PathVariable String phone){
        boolean flag = smsService.sendCode(phone);

        if(flag){
            return R.ok();
        }else {
            return R.error();
        }
    }
}
